<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
	    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	    <link rel="stylesheet" href="../../css/aui.css">
	    <link rel="stylesheet" href="../../css/retrievePsd.css">
	    <script src="../../js/api.js"></script>
	    <script src="../../js/common.js"></script>
	    <title>注册</title>
	</head>
	<body>
		
		<div id="box">

			<div class="WD-shenti">
				
				
				<div class="WD-nav">
					<div class="WD-info flex al">
						<div class="lmLogo">
							<div class="password"></div>
						</div>
						<div class="passwordone">
							<input type="password" placeholder="请设置6-20位数字或字母密码" v-model="password.loginPwd" @blur="regpass"/>
						</div>
					</div>
					
					<div class="WD-info flex al">
						<div class="lmLogo">
							<div class="password"></div>
						</div>
						<div class="passwordtwo">
							<input type="password" placeholder="请再次输入密码" v-model="password.password_confirm" @blur="confirmPass"/>
						</div>
					</div>
					
				</div>
				<div class="next" style="margin-top: 1.9rem" @click="surePass">完成</div>
			</div>

		</div>	
		
	</body>
	<script src="https://cdn.bootcss.com/vue/2.5.15/vue.js"></script>
	<script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/vue-resource.min.js" charset="utf-8"></script>
    <script>
        $(function () {
            var app = new Vue({
                el: '#box',
                data: {
                    goods: [],  // 猜你喜欢
					password:{
                        password_confirm:'',
						loginPwd:'',
                        regTerminal:2
					}
                },
				methods:{
                    regpass:function(){
                        var reg = /^[\w.]{6,20}$/;
                        if(reg.test(this.password.loginPwd)){
                            alert('密码可用')
						}else{
                            alert('请设置6-20位数字或字母密码')
						}
					},
					confirmPass:function(){
                        if(this.password.password_confirm!=this.password.loginPwd){
                            alert('两次出入密码不相等')
                        }
					},
                    surePass:function () {
					var params={};
					params=Object.assign(this.password);

                     // params=	Object.assign(this.password,JSON.parse(localStorage.reg));
                                this.$http.post(SURL+'app/users/register',params,{emulateJSON:true}).then(function (res) {
                                   // console.log(res)
									if(res.body.status==1){
                                        alert('注册成功')
									}
                                })
                    }
				}
            });
        })
    </script>
    <!--TODO：表单验证-->
</html>
